//
//  AboutProducController.m
//  QuickCure37
//
//  Created by 马文星 on 16/6/18.
//  Copyright © 2016年 Demos. All rights reserved.
//

#import "AboutProducController.h"

@interface AboutProducController () <UITableViewDataSource,UITableViewDelegate>

@property (nonatomic, strong) UIImageView *iconV1; //图标1
@property (nonatomic, strong) UIImageView *iconV2; //图标2

@property (nonatomic, strong) UILabel *lab1; //用户交流群
@property (nonatomic, strong) UILabel *lab2; //版本

@property (nonatomic, strong) UITableView *tableview;

@end

@implementation AboutProducController

static NSString *ID = @"cell";

- (void)viewDidLoad {
    [super viewDidLoad];
    
    
    [self setupUI];
}

- (void)setupUI{

    self.title = @"关注产品";
    
    self.automaticallyAdjustsScrollViewInsets = NO;
    
    [self.view addSubview:self.iconV1];
    [self.view addSubview:self.iconV2];
    [self.view addSubview:self.tableview];
    
    
    [self.view addSubview:self.lab1];
    [self.view addSubview:self.lab2];
    
   
    
    [self.iconV1 mas_makeConstraints:^(MASConstraintMaker *make) {
    
        make.top.mas_equalTo(100);
        make.centerX.mas_equalTo(self.view.mas_centerX);
        make.size.mas_equalTo(CGSizeMake(70, 90));
        
    }];
    
    [self.iconV2 mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.mas_equalTo(self.iconV1.mas_bottom).offset(5);
        make.centerX.mas_equalTo(self.view.mas_centerX);
        make.size.mas_equalTo(CGSizeMake(70, 45));
    }];
    
    [self.tableview mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.mas_equalTo(self.iconV2.mas_bottom).offset(40);
        make.leading.right.mas_equalTo(0);
        make.height.mas_equalTo(50);
    }];
    
    
    [self.lab2 mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.bottom.mas_equalTo(-50);
        make.centerX.mas_equalTo(self.view.mas_centerX);
        make.size.mas_equalTo(CGSizeMake(200, 30));
        
    }];
    
    [self.lab1 mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.bottom.mas_equalTo(self.lab2.mas_top).offset(-10);
        make.centerX.mas_equalTo(self.view.mas_centerX);
        make.size.mas_equalTo(CGSizeMake(300, 30));
        
    }];
}

#pragma mark  - UITableViewDataSource
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{

    return 1;
}

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{

    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:ID forIndexPath:indexPath];
    
    cell.textLabel.text = @"用户协议";
    cell.imageView.image  = [UIImage imageNamed:@"product_img_icon_xieyi.png"];
    
    cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
    
    return cell;
}

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{

    [SVPAlertManager alertSuccessStatus:@"打开用户协议"];
    
    [tableView deselectRowAtIndexPath:indexPath animated:YES];
}



#pragma mark  - Lazy
-(UITableView *)tableview{
    
    if (_tableview == nil) {
        _tableview= [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStylePlain];
        
        [_tableview registerClass:[UITableViewCell class] forCellReuseIdentifier:ID];
        
        _tableview.tableFooterView = [UIView new];
        
        _tableview.dataSource = self;
        _tableview.delegate = self;
        
        _tableview.scrollEnabled = NO;
        
        _tableview.rowHeight = 50;
    }
    return _tableview;
}


-(UIImageView *)iconV1{
    
    if (_iconV1 == nil) {
        _iconV1 = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"product_img_logo_nor.png"]];
    }
    return _iconV1;
}

-(UIImageView *)iconV2{
    
    if (_iconV2 == nil) {
        _iconV2 = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"product_text_logo_nor.png"]];
    }
    return _iconV2;
}

-(UILabel *)lab1{
    
    if (_lab1 == nil) {
        _lab1 = [[UILabel alloc] init];
        _lab1.text = @"用户交流群：4638375473";
        _lab1.textColor  = BLUE_COLOR;
        _lab1.textAlignment = NSTextAlignmentCenter;

    }
    return _lab1;
}

-(UILabel *)lab2{
    
    if (_lab2 == nil) {
        _lab2 = [[UILabel alloc] init];
        _lab2.text = @"version：1.4.0";
        _lab2.textColor  = BLUE_COLOR;
        _lab2.textAlignment = NSTextAlignmentCenter;
    }
    return _lab2;
}





@end
